#ifndef		__IPZ_LENS_H_
#define		__IPZ_LENS_H_

#ifdef	IPZ_LENS_GLOBAL
	#define	IPZ_LENS_EXT	
#else
	#define	IPZ_LENS_EXT		extern
#endif

#define 	T5183_3X__CURVE_NUM             46
#define 	T5183_3X_MIN_ZOOM_MOTOR_POS     0
#define 	T5183_3X_MAX_ZOOM_MOTOR_POS     4656
#define 	T5183_3X_LENS_ORIGIN            632
#define 	T5183_3X_LENS_LZ1               3700
#define 	T5183_3X_LENS_LZ5               3376
#define     T5183_3X_LENS_LF6               3388
#define	    T5183_3X_ZOOM_AF_POS            1800  
#define		T5183_3X_PWMMIN		            165
#define		T5183_3X_PWMMAX		            926

#define 	T5391_23X_CURVE_NUM             71
#define 	T5391_23X_MIN_ZOOM_MOTOR_POS    0
#define 	T5391_23X_MAX_ZOOM_MOTOR_POS    16088
#define 	T5391_23X_MIN_FOCUS_MOTOR_POS   -1340
#define 	T5391_23X_MAX_FOCUS_MOTOR_POS   4040
#define 	T5391_23X_MIN_IRCUT_MOTOR_POS   0
#define 	T5391_23X_MAX_IRCUT_MOTOR_POS   5440
#define 	T5391_23X_LENS_ORIGIN           -184
#define 	T5391_23X_LENS_IRCUT            5200
#define 	T5391_23X_LENS_LZ1              13500//13520
#define 	T5391_23X_LENS_LZ5              18032
#define     T5391_23X_LENS_LF6              9980
#define	    T5391_23X_ZOOM_AF_POS           4800  
#define		T5391_23X_PWMMIN		        165
#define		T5391_23X_PWMMAX		        926
#define		T5391_23X_HALLMIN		        0
#define		T5391_23X_HALLMAX		        1000
#define 	T5391_23X_LENS_IRCUT_DAY        2680
#define 	T5391_23X_LENS_IRCUT_NIGHT      5340
#define 	T5391_23X_LENS_IRCUT_DEFOG      0

#define 	T5291_37X_CURVE_NUM             78
#define 	T5291_37X_MIN_ZOOM_MOTOR_POS    0
#define 	T5291_37X_MAX_ZOOM_MOTOR_POS    18032
#define 	T5291_37X_MIN_FOCUS_MOTOR_POS   -4904
#define 	T5291_37X_MAX_FOCUS_MOTOR_POS   5076
#define 	T5291_37X_MIN_IRCUT_MOTOR_POS   -170
#define 	T5291_37X_MAX_IRCUT_MOTOR_POS   5440
#define 	T5291_37X_LENS_ORIGIN           -2188
#define 	T5291_37X_LENS_IRCUT            5200
#define 	T5291_37X_LENS_LZ1              14960
#define 	T5291_37X_LENS_LZ5              18032
#define     T5291_37X_LENS_LF6              9980
#define	    T5291_37X_ZOOM_AF_POS           4800  
#define		T5291_37X_PWMMIN		        165
#define		T5291_37X_PWMMAX		        926
#define		T5291_37X_HALLMIN		        0
#define		T5291_37X_HALLMAX		        1000
#define 	T5291_37X_LENS_IRCUT_DAY        2730//2880
#define 	T5291_37X_LENS_IRCUT_NIGHT      5340 
#define 	T5291_37X_LENS_IRCUT_DEFOG      -170


#define 	T5719_30X_CURVE_NUM              55
#define 	T5719_30X_MIN_ZOOM_MOTOR_POS     0
#define 	T5719_30X_MAX_ZOOM_MOTOR_POS     12000
#define 	T5719_30X_MIN_ZOOMC_MOTOR_POS    0
#define 	T5719_30X_MAX_ZOOMC_MOTOR_POS    5208
#define 	T5719_30X_MIN_FOCUS_MOTOR_POS    -3304
#define 	T5719_30X_MAX_FOCUS_MOTOR_POS    3420
#define 	T5719_30X_MIN_IRCUT_MOTOR_POS    -228
#define 	T5719_30X_MAX_IRCUT_MOTOR_POS    1800
#define 	T5719_30X_LENS_ORIGIN            -2314
#define 	T5719_30X_LENS_IRCUT             0
#define 	T5719_30X_LENS_IRIS_ORIGIN       100
#define 	T5719_30X_LENS_LZ1               10680//10648
#define 	T5719_30X_LENS_LC1               3424
#define 	T5719_30X_LENS_LZ5               12000
#define     T5719_30X_LENS_LF6               7516
#define	    T5719_30X_ZOOM_AF_POS            3000
#define		T5719_30X_PWMMIN		         165
#define		T5719_30X_PWMMAX		         926
#define		T5719_30X_HALLMIN		         0
#define		T5719_30X_HALLMAX		         1000
#define 	T5719_30X_LENS_IRCUT_DAY         784
#define 	T5719_30X_LENS_IRCUT_NIGHT       -228
#define 	T5719_30X_LENS_IRCUT_DEFOG       1800 


#define 	T5375_46X_CURVE_NUM             60
#define 	T5375_46X_MIN_ZOOM_MOTOR_POS    0
#define 	T5375_46X_MAX_ZOOM_MOTOR_POS    15344
#define 	T5375_46X_MIN_FOCUS_MOTOR_POS   -5720
#define 	T5375_46X_MAX_FOCUS_MOTOR_POS   3760
#define 	T5375_46X_MIN_IRCUT_MOTOR_POS   0
#define 	T5375_46X_MAX_IRCUT_MOTOR_POS   5440
#define 	T5375_46X_LENS_ORIGIN           -4428
#define 	T5375_46X_LENS_IRCUT            5200
#define 	T5375_46X_LENS_LZ1              14120
#define 	T5375_46X_LENS_LZ5              18032
#define     T5375_46X_LENS_LF6              9980
#define	    T5375_46X_ZOOM_AF_POS           4800  
#define		T5375_46X_PWMMIN		        165
#define		T5375_46X_PWMMAX		        926
#define		T5375_46X_HALLMIN		        0
#define		T5375_46X_HALLMAX		        1000
#define 	T5375_46X_LENS_IRCUT_DAY        2680
#define 	T5375_46X_LENS_IRCUT_NIGHT      5340
#define 	T5375_46X_LENS_IRCUT_DEFOG      0
#define     T5375_46X_IRIS_BLANK_STEP       0
#define     T5375_46X_IRCUT_BLANK_STEP      0
#define     T5375_46X_ZOOM_BLANK_STEP       0
#define     T5375_46X_FOCUS_BLANK_STEP      6
#define     T5375_46X_ZOOMC_BLANK_STEP      0




#define 	F062_35X_CURVE_NUM              71
#define 	F062_35X_MIN_ZOOM_MOTOR_POS     0
#define 	F062_35X_MAX_ZOOM_MOTOR_POS     14468
#define 	F062_35X_MIN_FOCUS_MOTOR_POS    -4856
#define 	F062_35X_MAX_FOCUS_MOTOR_POS    4692
#define 	F062_35X_LENS_ORIGIN            2100
#define 	F062_35X_LENS_LZ1               10480
#define 	F062_35X_LENS_LZ5               3376
#define     F062_35X_LENS_LF6               9548
#define	    F062_35X_ZOOM_AF_POS            4800  
#define		F062_35X_PWMMIN		            185
#define		F062_35X_PWMMAX		            875
#define		F062_35X_HALLMIN		        0
#define		F062_35X_HALLMAX		        1000


#define 	F028_33X_CURVE_NUM              141
#define 	F028_33X_MIN_ZOOM_MOTOR_POS     0
#define 	F028_33X_MAX_ZOOM_MOTOR_POS     12216
#define 	F028_33X_MIN_FOCUS_MOTOR_POS    -4856
#define 	F028_33X_MAX_FOCUS_MOTOR_POS    3092
#define 	F028_33X_LENS_ORIGIN            1016
#define 	F028_33X_LENS_LZ1               7560
#define 	F028_33X_LENS_LZ5               12216
#define     F028_33X_LENS_LF6               8140
#define	    F028_33X_ZOOM_AF_POS            3400  
#define		F028_33X_PWMMIN		            185
#define		F028_33X_PWMMAX		            875
#define		F028_33X_HALLMIN		        0
#define		F028_33X_HALLMAX		        1000

#define 	F162_20X_CURVE_NUM              55
#define 	F162_20X_MIN_ZOOM_MOTOR_POS     0
#define 	F162_20X_MAX_ZOOM_MOTOR_POS     13240
#define 	F162_20X_MIN_FOCUS_MOTOR_POS    -2328
#define 	F162_20X_MAX_FOCUS_MOTOR_POS    1652
#define 	F162_20X_LENS_ORIGIN            -508
#define 	F162_20X_LENS_LZ1               12240
#define 	F162_20X_LENS_LZ5               13240
#define	    F162_20X_ZOOM_AF_POS            3400  
#define		F162_20X_PWMMIN		            185
#define		F162_20X_PWMMAX		            875
#define		F162_20X_HALLMIN		        0
#define		F162_20X_HALLMAX		        1000

#define 	F027_26X_CURVE_NUM              100
#define 	F027_26X_MIN_ZOOM_MOTOR_POS     0
#define 	F027_26X_MAX_ZOOM_MOTOR_POS     11200
#define 	F027_26X_MIN_FOCUS_MOTOR_POS    -3104
#define 	F027_26X_MAX_FOCUS_MOTOR_POS    2740
#define 	F027_26X_LENS_ORIGIN            540
#define 	F027_26X_LENS_LZ1               6568
#define 	F027_26X_LENS_LZ5               12216
#define     F027_26X_LENS_LF6               8140
#define	    F027_26X_ZOOM_AF_POS            2700  
#define		F027_26X_PWMMIN		            185
#define		F027_26X_PWMMAX		            875
#define		F027_26X_HALLMIN		        0
#define		F027_26X_HALLMAX		        1000



#define 	F124_52X_CURVE_NUM              76
#define 	F124_52X_MIN_ZOOM_MOTOR_POS     0
#define 	F124_52X_MAX_ZOOM_MOTOR_POS     23400
#define 	F124_52X_MIN_ZOOMC_MOTOR_POS    0
#define 	F124_52X_MAX_ZOOMC_MOTOR_POS    4652
#define 	F124_52X_MIN_FOCUS_MOTOR_POS    -4472
#define 	F124_52X_MAX_FOCUS_MOTOR_POS    1872
#define 	F124_52X_MIN_IRIS_MOTOR_POS     10
#define 	F124_52X_MAX_IRIS_MOTOR_POS     170
#define 	F124_52X_LENS_ORIGIN            -1548
#define 	F124_52X_LENS_IRIS_ORIGIN       100
#define 	F124_52X_LENS_LZ1               14082//14112
#define 	F124_52X_LENS_LC1               2436//2404
#define 	F124_52X_LENS_LZ5               3376
#define     F124_52X_LENS_LF6               9548
#define	    F124_52X_ZOOM_AF_POS            7200  


#define 	T5709_4X_CURVE_NUM              51
#define 	T5709_4X_MIN_ZOOM_MOTOR_POS     0
#define 	T5709_4X_MAX_ZOOM_MOTOR_POS     5000
#define 	T5709_4X_MIN_FOCUS_MOTOR_POS    -108
#define 	T5709_4X_MAX_FOCUS_MOTOR_POS    880
#define 	T5709_4X_LENS_ORIGIN            308
#define 	T5709_4X_LENS_LZ1               3000
#define 	T5709_4X_LENS_LZ5               5000
#define     T5709_4X_LENS_LF6               2760
#define	    T5709_4X_ZOOM_AF_POS            3800  
#define		T5709_4X_PWMMIN		            185
#define		T5709_4X_PWMMAX		            875
#define		T5709_4X_HALLMIN		        0
#define		T5709_4X_HALLMAX		        1000

#define 	T5188_6X_CURVE_NUM              57
#define 	T5188_6X_MIN_ZOOM_MOTOR_POS     0
#define 	T5188_6X_MAX_ZOOM_MOTOR_POS     9076
#define 	T5188_6X_MIN_FOCUS_MOTOR_POS    -752
#define 	T5188_6X_MAX_FOCUS_MOTOR_POS    1588
#define 	T5188_6X_LENS_ORIGIN            0
#define 	T5188_6X_LENS_LZ1               8332
#define 	T5188_6X_LENS_LZ5               9074
#define     T5188_6X_LENS_LF6               8140
#define	    T5188_6X_ZOOM_AF_POS            7600  
#define		T5188_6X_PWMMIN		            185
#define		T5188_6X_PWMMAX		            875
#define		T5188_6X_HALLMIN		        0
#define		T5188_6X_HALLMAX		        1000


#define 	F140X_90X_CURVE_NUM              79
#define 	F140X_90X_MIN_ZOOM_MOTOR_POS     0
#define 	F140X_90X_MAX_ZOOM_MOTOR_POS     21160
#define 	F140X_90X_MIN_ZOOMC_MOTOR_POS    0
#define 	F140X_90X_MAX_ZOOMC_MOTOR_POS    0
#define 	F140X_90X_MIN_FOCUS_MOTOR_POS    0
#define 	F140X_90X_MAX_FOCUS_MOTOR_POS    14108
#define 	F140X_90X_MIN_IRIS_MOTOR_POS     5
#define 	F140X_90X_MAX_IRIS_MOTOR_POS     150
#define 	F140X_90X_LENS_ORIGIN            8916
#define 	F140X_90X_LENS_IRIS_ORIGIN       150
#define 	F140X_90X_LENS_LZ1               20176
#define 	F140X_90X_LENS_LC1               2436
#define 	F140X_90X_LENS_LZ5               3376
#define     F140X_90X_LENS_LF6               9548
#define	    F140X_90X_ZOOM_AF_POS            1200  
#define	    F140X_90X_ZOOM_BLANK_STEP        40 

#define 	F140L_86X_CURVE_NUM              79
#define 	F140L_86X_MIN_ZOOM_MOTOR_POS     0
#define 	F140L_86X_MAX_ZOOM_MOTOR_POS     21120
#define 	F140L_86X_MIN_ZOOMC_MOTOR_POS    0
#define 	F140L_86X_MAX_ZOOMC_MOTOR_POS    0
#define 	F140L_86X_MIN_FOCUS_MOTOR_POS    0
#define 	F140L_86X_MAX_FOCUS_MOTOR_POS    14508//14108
#define 	F140L_86X_MIN_IRIS_MOTOR_POS     5
#define 	F140L_86X_MAX_IRIS_MOTOR_POS     150
#define 	F140L_86X_LENS_ORIGIN            8916
#define 	F140L_86X_LENS_IRIS_ORIGIN       150
#define 	F140L_86X_LENS_LZ1               20176
#define 	F140L_86X_LENS_LC1               2436
#define 	F140L_86X_LENS_LZ5               3376
#define     F140L_86X_LENS_LF6               9548
#define	    F140L_86X_ZOOM_AF_POS            1200  
#define	    F140L_86X_ZOOM_BLANK_STEP        40

#define 	F140LL_83X_MAX_ZOOM_MOTOR_POS    21086

#define 	F140LLL_75X_CURVE_NUM              78
#define 	F140LLL_75X_MIN_ZOOM_MOTOR_POS     0
#define 	F140LLL_75X_MAX_ZOOM_MOTOR_POS     21086
#define 	F140LLL_75X_MIN_ZOOMC_MOTOR_POS    0
#define 	F140LLL_75X_MAX_ZOOMC_MOTOR_POS    0
#define 	F140LLL_75X_MIN_FOCUS_MOTOR_POS    0
#define 	F140LLL_75X_MAX_FOCUS_MOTOR_POS    14108
#define 	F140LLL_75X_MIN_IRIS_MOTOR_POS     5
#define 	F140LLL_75X_MAX_IRIS_MOTOR_POS     150
#define 	F140LLL_75X_LENS_ORIGIN            8916
#define 	F140LLL_75X_LENS_IRIS_ORIGIN       150
#define 	F140LLL_75X_LENS_LZ1               20176
#define 	F140LLL_75X_LENS_LC1               2436
#define 	F140LLL_75X_LENS_LZ5               3376
#define     F140LLL_75X_LENS_LF6               9548
#define	    F140LLL_75X_ZOOM_AF_POS            1200  
#define	    F140LLL_75X_ZOOM_BLANK_STEP        40

#define     ZOOM_SPEED_TABLE                9
#define     CURVE_OFFSET_MAX                100

#define		SONY_DZOOM_LEVEL			    16
#define		HISI_DZOOM_LEVEL			    16
#define     RAPTOR_DZOOM_LEVEL              10
#define		SONY_MAX_OPTICAL_ZOOM_COORD	    0x4000	



#define		QUERY_MF_MOTOR_POS()		(IPZ_ZBC_MOTOR_ReadZoomSensor())
#define		QUERY_AF_MOTOR_POS()		(IPZ_ZBC_MOTOR_ReadFocusSensor()) 
#define		QUERY_ZC_MOTOR_POS()		(IPZ_ZBC_MOTOR_ReadZoomCSensor())
#define		QUERY_IRIS_MOTOR_POS()		(IPZ_ZBC_MOTOR_ReadIrisSensor()) 
#define		QUERY_IRCUT_MOTOR_POS()		(IPZ_ZBC_MOTOR_ReadIrcutSensor()) 


#define     ZOOM_LOCK 1
#define     FOCUS_LOCK 1


typedef struct _IPZ_ZBC_LENS_STATUS
{
    
    SW_BOOL   	bFocusRotation;
	SW_BOOL   	bPreFocusRotation;
    SW_BOOL   	bZoomRotation;
	SW_BOOL   	bPreZoomRotation;
    SW_BOOL   	bZoomCRotation;
	SW_BOOL   	bPreZoomCRotation;
    SW_BOOL   	bIrisRotation;
	SW_BOOL   	bPreIrisRotation;
	SW_BOOL   	bIrcutRotation;
	SW_BOOL   	bPreIrcutRotation;
    SW_BOOL     bDoZoomTele;
    SW_BOOL     bDoFocusNear;
    SW_BOOL     bIsZoomDirectRunning;
    SW_BOOL     bIsFocusDirectRunning;
    SW_INT    	s32FocusStepNum;
    SW_INT    	s32ZoomStepNum;
    SW_INT    	s32ZoomCStepNum;
    SW_INT    	s32IrisStepNum;
	SW_INT    	s32IrcutStepNum;
    SW_INT      s16MZoomShift;
    SW_INT      s16MZoomCShift;
    SW_INT      s16MFocusShift;
    SW_INT      s16MIrisShift;
	SW_INT      s16MIrcutShift;
	SW_INT      s16ZoomBlankStep;
    
    

    SW_INT      s32FocusMotorCurPos;
    SW_INT      s32ZoomMotorCurPos;
    SW_INT      s32ZoomCMotorCurPos;
    SW_INT      s32IrisMotorCurPos;
	SW_INT      s32IrcutMotorCurPos;
    SW_INT      s32DZOOMCurPos;
	SW_INT		s32LastAdjustZoomDiff;
	SW_INT		s32LastAdjustTmp;
    SW_FLOAT    f32FocusMotorCurPosAdj;
    SW_FLOAT    f32ZoomMotorCurPosAdj;
    SW_FLOAT    f32ZoomCMotorCurPosAdj;
    SW_FLOAT    f32IrisMotorCurPosAdj;
	SW_FLOAT    f32IrcutMotorCurPosAdj;
    SW_FLOAT    f32DZOOMCurPosAdj;

    SW_INT      s32DriverMotorFlag;
    SW_BOOL     bMotorInitDone;
    SW_BOOL     bDoFocusFar2Near;
 	SW_BOOL     bDoZoomWide2Tele;
    SW_BOOL     bLensInitDone;
    SW_BOOL     bZoomChnFlag;

}IPZ_ZBC_LENS_STATUS;



typedef struct _IPZ_ZBC_LENS_ATTR
{

    SW_UINT32   u32MotorStepCycle;
    
    SW_INT16    s16ZoomMotorShift;
    SW_INT16    s16ZoomCMotorShift;
    SW_INT16    s16FocusMotorShift;
    SW_INT16    s16IrisMotorShift;
	SW_INT16    s16IrCutMotorShift;
    SW_INT16    s16ZoomMotorPI;
    SW_INT16    s16ZoomCMotorPI;
    SW_INT16    s16FocusMotorPI;
    SW_INT16    s16IrisMotorPI;
	SW_INT16    s16IrcutMotorPI;
    SW_UINT16   u16ZoomMotorMaxStep;
    SW_UINT16   u16ZoomCMotorMaxStep;
    SW_UINT16   u16FocusMotorMaxStep;
    SW_UINT16   u16IrisMotorMaxStep;
	SW_UINT16   u16IrcutMotorMaxStep;
    SW_UINT16   u16ZoomMotorMinStep;
    SW_UINT16   u16ZoomCMotorMinStep;
    SW_UINT16   u16FocusMotorMinStep;
    SW_UINT16   u16IrisMotorMinStep;
	SW_UINT16   u16IrcutMotorMinStep;

	SW_UINT16   u16ZoomBlankStep;
	SW_UINT16   u16FocusBlankStep;
	SW_UINT16   u16ZoomCBlankStep;
	SW_UINT16   u16IrisBlankStep;
	SW_UINT16   u16IrcutBlankStep;

    SW_UINT16   u16CurveNum;
    SW_INT16    s16ZoomCoordMax;
    SW_INT16    s16ZoomCoordMin;
    SW_INT16    s16ZoomCoordlimitMax;
    SW_INT16    s16ZoomCoordlimitMin;
    SW_INT16    s16ZoomCCoordMax;
	SW_INT16    s16ZoomCCoordMin; 
    SW_INT16    s16FocusCoordMax; 
	SW_INT16    s16FocusCoordMin; 
    SW_INT16    s16IrisCoordMax; 
	SW_INT16    s16IrisCoordMin; 
	SW_INT16    s16IrcutCoordMax; 
	SW_INT16    s16IrcutCoordMin; 
    SW_INT16    s16LensInfFocusMax;
    SW_INT16    s16LensInfFocusAll;

    SW_INT16    *pZoomMagniCoordTbl;
    SW_INT16    s16ZoomTraceStartCoord;

    SW_INT16    s16LensLZ1Coord;
    SW_INT16    s16LensLZ1CoordDiff;
    SW_INT16    s16LensOrigion;

    SW_UINT16   u16Lens1MDifNum; 
	SW_UINT16   u16Lens30CMDifNum;
	SW_UINT16   u16Lens10CMDifNum;
    SW_INT16    *pLens1MDif; 
	SW_INT16    *pLens30CMDif; 
	SW_INT16    *pLens10CMDif; 

    SW_UINT8    (*pZoomSpdTbl)[ZOOM_SPEED_TABLE];   
	SW_INT16    (*pZoomSpdCoordTbl)[ZOOM_SPEED_TABLE]; 

   // SW_INT16    (*pICRCompOffset1Tbl)[CURVE_OFFSET_MAX]; 
	//SW_INT16    (*pICRCompOffset2Tbl)[CURVE_OFFSET_MAX]; 
	SW_INT16    (*pCurveOffsetUpper)[CURVE_OFFSET_MAX]; 
	SW_INT16    (*pCurveOffsetLower)[CURVE_OFFSET_MAX]; 
    
    SW_INT16    s16PwmPosMin;
    SW_INT16    s16PwmPosMax;
    SW_INT16    s16HallPosMax;
    SW_INT16    s16HallPosMin;
    SW_INT16    s16HallDiff;									
    SW_INT16    s16PwmDiff;
    SW_INT16    s16PwmDiffDown;
    SW_INT16    s16PwmDiffUp;
    
}IPZ_ZBC_LENS_ATTR;

typedef struct _IPZ_ZBC_LENS_PARAM
{
    SW_UINT32 u32ZoomPos;               /**< Zoom position */
    SW_UINT32 u32ZoomRatio;             /**< Zoom ratio U22Q10*/
    SW_UINT32 u32HallMax;               /**< Maximum hall ratio U16Q16 */
    SW_UINT32 u32HallMtf;               /**< Hall ratio for best MTF U16Q16 */
    SW_UINT32 u32HallLowLight;          /**< Hall ratio for best MTF U16Q16 */
    SW_INT32  s32LdcRatio;               /**< LDC ratio */
    SW_UINT32 u32LumRatioLinear;        /**< Luminance ratio linear U22Q10 */
    SW_UINT32 u32LumRatioWdr;           /**< Luminance ratio wdr U22Q10 */
    SW_UINT32 u32SharpenRatioLinear;    /**< Sharpen ratio linear U22Q10 */
    SW_UINT32 u32SharpenRatioWdr;       /**< Sharpen ratio wdr U22Q10 */
}IPZ_ZBC_LENS_PARAM;

typedef struct _IPZ_ZBC_LENS_CTX
{
    SW_MUTEX hLensMutex;
    IPZ_ZBC_LENS_STATUS stStatus;
    IPZ_ZBC_LENS_ATTR stAttr;
    IPZ_ZBC_LENS_PARAM *stParam;
    SW_UINT32 stParamNum;
}IPZ_ZBC_LENS_CTX;


SW_RET IPZ_ZBC_LENS_LensInit(void);
SW_BOOL  IPZ_ZBC_LENS_ZposLock(SW_INT  ul);
SW_BOOL  IPZ_ZBC_LENS_FposLock(SW_BOOL  bNear);
SW_RET IPZ_ZBC_LENS_LensExit(void);
SW_BOOL IPZ_ZBC_LENS_GetLensStatus(void);
void IPZ_ZBC_LENS_SetLensStatus(SW_BOOL bLensInitDone);
SW_BOOL IPZ_ZBC_LENS_GetMotorStatus(void);
void IPZ_ZBC_LENS_SetMotorStatus(SW_BOOL bMotorInitDone);
SW_INT IPZ_ZBC_LENS_StepMotorInit(SW_BOOL T_TEST);
SW_UINT16 IPZ_ZBC_LENS_GetCurveNum(void);
SW_UINT16 IPZ_ZBC_LENS_GetCurve1MDifNum(void);
SW_UINT16 IPZ_ZBC_LENS_GetCurve30CMDifNum(void);
SW_UINT16 IPZ_ZBC_LENS_GetCurve10CMDifNum(void);
SW_INT16* IPZ_ZBC_LENS_GetCurve1MDif(void);
SW_INT16* IPZ_ZBC_LENS_GetCurve30CMDif(void);
SW_INT16* IPZ_ZBC_LENS_GetCurve10CMDif(void);
SW_INT16 IPZ_ZBC_LENS_GetPwmMax(void);
SW_INT16 IPZ_ZBC_LENS_GetPwmMin(void);
SW_INT16 IPZ_ZBC_LENS_GetPwmDiffUp(void);
SW_INT16 IPZ_ZBC_LENS_SetPwmDiffUp(SW_INT16 s16PwmDiffUp);
SW_INT16 IPZ_ZBC_LENS_GetPwmDiffDown(void);
SW_INT16 IPZ_ZBC_LENS_SetPwmDiffDown(SW_INT16 s16PwmDiffDown);
SW_INT16 IPZ_ZBC_LENS_GetPwmRealMax(void);
SW_INT16 IPZ_ZBC_LENS_GetPwmRealMin(void);
SW_INT IPZ_ZBC_LENS_SetPwmMax(SW_INT16 s16PwmMax);
SW_INT IPZ_ZBC_LENS_SetPwmMin(SW_INT16 s16PwmMin);
SW_INT16 IPZ_ZBC_LENS_GetHallMax(void);
SW_INT16 IPZ_ZBC_LENS_GetHallMin(void);
SW_INT16 IPZ_ZBC_LENS_GetHallDiffMin(void);
SW_INT16 IPZ_ZBC_LENS_SetHallMax(SW_INT16 s16HallPosMax);
SW_INT16 IPZ_ZBC_LENS_SetHallMin(SW_INT16 s16HallPosMin);
SW_INT16 IPZ_ZBC_LENS_SetHallDiffMin(SW_INT16 s16HallDiff);
SW_INT16 IPZ_ZBC_LENS_GetLensZoomMinMax(SW_INT16 b);
SW_INT16 IPZ_ZBC_LENS_SetLensZoomMinMax(SW_BOOL b,SW_INT16 limit);
SW_INT16 IPZ_ZBC_LENS_SetLensZoomMinMaxLimit(SW_BOOL b,SW_INT16 limit);
SW_INT16  IPZ_ZBC_LENS_GetLensZoomMinMaxLimit(SW_UINT8 b);
SW_INT16 IPZ_ZBC_LENS_SetLensFocusMinMaxLimit(SW_BOOL b,SW_INT16 limit);
SW_INT16 IPZ_ZBC_LENS_GetLensInfFocusAll(void);
SW_INT16 IPZ_ZBC_LENS_GetLensFocusMinMax(SW_UINT8	 b);
SW_INT16 IPZ_ZBC_LENS_GetLensZoomCMinMax(SW_UINT8	 b);
SW_INT16 IPZ_ZBC_LENS_GetLensIrisMinMax(SW_UINT8	 b);
SW_INT16 IPZ_ZBC_LENS_GetLensIrcutMinMax(SW_UINT8	 b);
SW_BOOL IPZ_ZBC_LENS_IsDZoomLock(SW_INT ul);
SW_BOOL	IPZ_ZBC_LENS_DriverFocusFar(void);
SW_BOOL	IPZ_ZBC_LENS_DriverFocusNear(void);
SW_BOOL IPZ_ZBC_LENS_DriverZoomTele(SW_INT	N);
SW_BOOL IPZ_ZBC_LENS_DriverZoomWide(SW_INT	N);
SW_BOOL IPZ_ZBC_LENS_DriverZoomTeleDirect(SW_INT sony_coord,SW_INT N);
SW_BOOL IPZ_ZBC_LENS_DriverZoomWideDirect(SW_INT sony_coord,SW_INT N);
void IPZ_ZBC_LENS_GotoFocusPosSlow(SW_INT  N, SW_INT  pos);
void IPZ_ZBC_LENS_GotoZFPos(SW_INT step,SW_INT  zoom,SW_INT focus);
void IPZ_ZBC_LENS_GotoZoomPos(SW_INT step,SW_INT  zoom);
void IPZ_ZBC_LENS_GotoIrcutPos(SW_INT step,SW_INT  ircut);
void IPZ_ZBC_LENS_GotoFocusPos(SW_INT  N, SW_INT  pos);
void IPZ_ZBC_LENS_GotoIrisPos(SW_INT step,SW_INT  pos);
void  IPZ_ZBC_LENS_WaitFocusMotorStop(SW_CHAR bDir);
SW_INT  IPZ_ZBC_LENS_ZoomMotorDriver(void);
SW_INT  IPZ_ZBC_LENS_ZoomMotorDriverDirect(SW_INT z);
void IPZ_ZBC_LENS_ZoomDrvThread(void);
void IPZ_ZBC_LENS_ZoomDrvDirectThread(void);
void IPZ_ZBC_LENS_FocusDrvThread( void );
SW_BOOL	IPZ_ZBC_LENS_DZoomWide(void);
SW_BOOL	IPZ_ZBC_LENS_DZoomTele(void);
void IPZ_ZBC_LENS_DZoomWideDirect(SW_INT s);
void IPZ_ZBC_LENS_DZoomTeleDirect(SW_INT s);
void IPZ_ZBC_LENS_EZOOM(SW_UINT32 v);
void IPZ_ZBC_LENS_DZoomDrvThread(void);
void IPZ_ZBC_LENS_DZoomDrvDirectThread(void );
void IPZ_ZBC_LENS_FocusDrvDirectThread(void );
SW_UINT8 IPZ_ZBC_LENS_GetZoomFollowStepNum(SW_INT  zoom);
SW_INT IPZ_ZBC_LENS_GetDZoomCurPos(void);
SW_FLOAT IPZ_ZBC_LENS_GetDZoomCurPosAdj(void);
SW_INT IPZ_ZBC_LENS_GetZoomCurPos(void);
SW_FLOAT IPZ_ZBC_LENS_GetZoomCurPosAdj(void);
SW_INT IPZ_ZBC_LENS_GetZoomCCurPos(void);
SW_FLOAT IPZ_ZBC_LENS_GetZoomCCurPosAdj(void);
SW_INT IPZ_ZBC_LENS_GetFocusCurPos(void);
SW_FLOAT IPZ_ZBC_LENS_GetFocusCurPosAdj(void);
SW_INT IPZ_ZBC_LENS_GetIrisCurPos(void);
SW_FLOAT IPZ_ZBC_LENS_GetIrisCurPosAdj(void);
SW_INT IPZ_ZBC_LENS_GetIrcutCurPos(void);
SW_FLOAT IPZ_ZBC_LENS_GetIrcutCurPosAdj(void);
void IPZ_ZBC_LENS_SetDZoomCurPos(SW_INT s32DZoomPos);
void IPZ_ZBC_LENS_SetDZoomCurPosAdj(SW_FLOAT s32DZoomPosAdj);
void IPZ_ZBC_LENS_SetZoomCurPos(SW_INT s32DZoomPos);
void IPZ_ZBC_LENS_SetZoomCurPosAdj(SW_FLOAT s32DZoomPosAdj);
void IPZ_ZBC_LENS_SetZoomCCurPos(SW_INT s32ZoomCPos);
void IPZ_ZBC_LENS_SetZoomCCurPosAdj(SW_FLOAT s32ZoomCPosAdj);
void IPZ_ZBC_LENS_SetFocusCurPos(SW_INT s32FocusPos);
void IPZ_ZBC_LENS_SetFocusCurPosAdj(SW_FLOAT s32FocusPosAdj);
void IPZ_ZBC_LENS_SetIrisCurPos(SW_INT s32IrisPos);
void IPZ_ZBC_LENS_SetIrisCurPosAdj(SW_FLOAT f32IrisMotorCurPosAdj);
void IPZ_ZBC_LENS_SetIrcutCurPos(SW_INT s32IrcutPos);
void IPZ_ZBC_LENS_SetIrcutCurPosAdj(SW_FLOAT f32IrcutMotorCurPosAdj);
SW_INT IPZ_ZBC_LENS_GetZoomStepNum(void);
void IPZ_ZBC_LENS_SetZoomStepNum(SW_INT s32ZoomStepNum);
SW_INT IPZ_ZBC_LENS_GetZoomCStepNum(void);
void IPZ_ZBC_LENS_SetZoomCStepNum(SW_INT s32ZoomCStepNum);
SW_INT IPZ_ZBC_LENS_GetFocusStepNum(void);
void IPZ_ZBC_LENS_SetFocusStepNum(SW_INT s32FocusStepNum);
SW_INT IPZ_ZBC_LENS_GetIrisStepNum(void);
void IPZ_ZBC_LENS_SetIrisStepNum(SW_INT s32IrisStepNum);
SW_INT IPZ_ZBC_LENS_GetIrcutStepNum(void);
void IPZ_ZBC_LENS_SetIrcutStepNum(SW_INT s32IrcutStepNum);
SW_INT16 IPZ_ZBC_LENS_GetMZoomShift(void);
void IPZ_ZBC_LENS_SetMZoomShift(SW_INT16 s16MZoomShift);
SW_INT16 IPZ_ZBC_LENS_GetZoomBlankStep(void);
void IPZ_ZBC_LENS_SetZoomBlankStep(SW_INT16 s16ZoomBlankStep);
SW_INT16 IPZ_ZBC_LENS_GetMZoomCShift(void);
void IPZ_ZBC_LENS_SetMZoomCShift(SW_INT16 s16MZoomCShift);
SW_INT16 IPZ_ZBC_LENS_GetMFocusShift(void);
void IPZ_ZBC_LENS_SetMFocusShift(SW_INT16 s16MFocusShift);
SW_INT16 IPZ_ZBC_LENS_GetMIrisShift(void);
void IPZ_ZBC_LENS_SetMIrisShift(SW_INT16 s16MIrisShift);
SW_INT16 IPZ_ZBC_LENS_GetMIrcutShift(void);
void IPZ_ZBC_LENS_SetMIrcutShift(SW_INT16 s16MIrcutShift);
SW_INT16 IPZ_ZBC_LENS_GetZoomShiftNum(void);
SW_INT IPZ_ZBC_LENS_GetFocusShiftNum(void);
SW_INT IPZ_ZBC_LENS_GetIrcutShiftNum(void);
SW_INT IPZ_ZBC_LENS_GetIrisShiftNum(void);
SW_BOOL IPZ_ZBC_LENS_GetDoZoomTele(void); 
void IPZ_ZBC_LENS_SetDoZoomTele(SW_BOOL bDoZoomTele);
SW_BOOL IPZ_ZBC_LENS_GetDoFocusNear(void);
void IPZ_ZBC_LENS_SetDoFocusNear(SW_BOOL bDoFocusNear);
SW_INT IPZ_ZBC_LENS_GetZoomMaxStep(void);
void IPZ_ZBC_LENS_SetZoomMaxStep(SW_INT u16ZoomMotorMaxStep);
void IPZ_ZBC_LENS_SetFocusMaxStep(SW_INT u16FocusMotorMaxStep);
SW_INT IPZ_ZBC_LENS_GetZoomCMaxStep(void);
SW_INT IPZ_ZBC_LENS_GetFocusMaxStep(void);
SW_INT IPZ_ZBC_LENS_GetIrisMaxStep(void);
SW_INT IPZ_ZBC_LENS_GetIrcutMaxStep(void);
SW_BOOL IPZ_ZBC_LENS_GetZoomChnStatus(void);
void IPZ_ZBC_LENS_SetZoomChnStatus(SW_BOOL bZoomChnFlag);
SW_BOOL IPZ_ZBC_LENS_GetZoomDir(void);
SW_BOOL IPZ_ZBC_LENS_GetZoomCDir(void);
SW_BOOL IPZ_ZBC_LENS_GetPreZoomDir(void);
SW_BOOL IPZ_ZBC_LENS_GetPreZoomCDir(void);
void IPZ_ZBC_LENS_SetZoomDir(SW_BOOL bZoomRotation);
void IPZ_ZBC_LENS_SetPreZoomDir(SW_BOOL bPreZoomRotation);
void IPZ_ZBC_LENS_SetZoomCDir(SW_BOOL bZoomCRotation);
void IPZ_ZBC_LENS_SetPreZoomCDir(SW_BOOL bPreZoomCRotation);
SW_BOOL IPZ_ZBC_LENS_GetFocusDir(void);
SW_BOOL IPZ_ZBC_LENS_GetPreFocusDir(void);
void IPZ_ZBC_LENS_SetFocusDir(SW_BOOL bFocusRotation);
void IPZ_ZBC_LENS_SetPreFocusDir(SW_BOOL bPreFocusRotation);
SW_BOOL IPZ_ZBC_LENS_GetIrisDir(void);
SW_BOOL IPZ_ZBC_LENS_GetPreIrisDir(void);
void IPZ_ZBC_LENS_SetIrisDir(SW_BOOL bIrisRotation);
SW_BOOL IPZ_ZBC_LENS_GetIrcutDir(void);
SW_BOOL IPZ_ZBC_LENS_GetPreIrcutDir(void);
void IPZ_ZBC_LENS_SetIrcutDir(SW_BOOL bIrcutRotation);
void IPZ_ZBC_LENS_SetIrisRun(SW_BOOL bIrisRotation, SW_UINT32 u32GoStep);
void IPZ_ZBC_LENS_ReverseFocusDir(void);
SW_INT16 IPZ_ZBC_LENS_GetLensLZ1Diff(void);
void IPZ_ZBC_LENS_SetLensLZ1Diff(SW_INT16 s16LensLZ1CoordDiff);
SW_INT16 IPZ_ZBC_LENS_GetLensLZ1(void);
void IPZ_ZBC_LENS_SetLensLZ1(SW_INT16 s16LensLZ1Coord);
SW_INT16 IPZ_ZBC_LENS_GetLensOrigion(void);
void IPZ_ZBC_LENS_SetLensOrigion(SW_INT16 s16LensOrigion);
SW_INT16 IPZ_ZBC_LENS_GetLensZoomPI(void);
void IPZ_ZBC_LENS_SetLensZoomPI(SW_INT16 s16ZoomMotorPI);
SW_INT16 IPZ_ZBC_LENS_GetLensFocusPI(void); 
void IPZ_ZBC_LENS_SetLensFocusPI(SW_INT16 s16FocusMotorPI);
SW_BOOL IPZ_ZBC_LENS_GetZoomDirectRunningFlag(void);
void IPZ_ZBC_LENS_SetZoomDirectRunningFlag(SW_BOOL bIsZoomDirectRunning);
SW_BOOL IPZ_ZBC_LENS_GetFocusDirectRunningFlag (void);
void IPZ_ZBC_LENS_SetFocusDirectRunningFlag(SW_BOOL bIsFocusDirectRunning);
void IPZ_ZBC_LENS_ReverseZoomDir(void);
IPZ_ZBC_LENS_PARAM * IPZ_ZBC_LENS_GetLensParamAddr(void);
SW_UINT32 IPZ_ZBC_LENS_GetLensParamNum(void);
SW_FLOAT IPZ_ZBC_LENS_SonyRate2DZOOMPrecise(SW_INT sony_rate);
SW_INT IPZ_ZBC_LENS_DZOOM2SonyRatePrecise(SW_FLOAT dzoom_mag);
SW_INT IPZ_ZBC_LENS_ViscaCoord2ZoomCoordPrecise(SW_INT  s);
SW_INT 	IPZ_ZBC_LENS_ZoomCoord2ViscaCoordPrecise(SW_FLOAT pos);
SW_FLOAT  IPZ_ZBC_LENS_ViscaCoord2FocusCoordPrecise(SW_INT coord);
SW_INT  IPZ_ZBC_LENS_FocusCoord2ViscaCoordPrecise(SW_FLOAT lens_pos);
void IPZ_ZBC_LENS_DriverZoomMotor(void);			
void IPZ_ZBC_LENS_DriverFocusMotor(void);			
void IPZ_ZBC_LENS_DriverZoomFocusMotor(void);			
SW_BOOL IPZ_ZBC_LENS_IsDZoomValid(void);
SW_UINT32 IPZ_ZBC_LENS_GetMaxDzoomPos(void);
SW_INT IPZ_ZBC_LENS_GetDZoomPosByRaptorDMag(SW_FLOAT dzMag);
SW_FLOAT IPZ_ZBC_LENS_ChangeDzMag(SW_FLOAT dst,SW_FLOAT src,SW_FLOAT curDzmag);
SW_INT16 IPZ_ZBC_LENS_GetLensLZ1Diff(void);
void IPZ_ZBC_LENS_SetLensLZ1Diff(SW_INT16 s16LensLZ1CoordDiff);
SW_INT16 IPZ_ZBC_LENS_GetLensLZ1(void);
void IPZ_ZBC_LENS_SetLensLZ1(SW_INT16 s16LensLZ1Coord);
SW_INT16 IPZ_ZBC_LENS_GetLensZoomPI(void);
void IPZ_ZBC_LENS_SetLensZoomPI(SW_INT16 s16ZoomMotorPI);
SW_INT16 IPZ_ZBC_LENS_GetLensFocusPI(void);
void IPZ_ZBC_LENS_SetLensFocusPI(SW_INT16 s16FocusMotorPI);
SW_INT16 IPZ_ZBC_LENS_GetLensZoomBlankStep(void);
void IPZ_ZBC_LENS_SetLensZoomBlankStep(SW_INT16 u16ZoomBlankStep);
SW_INT16 IPZ_ZBC_LENS_GetLensFocusBlankStep(void);
void IPZ_ZBC_LENS_SetLensFocusBlankStep(SW_INT16 u16FocusBlankStep);
SW_INT16 IPZ_ZBC_LENS_GetLensZoomCBlankStep(void);
void IPZ_ZBC_LENS_SetLensZoomCBlankStep(SW_INT16 u16ZoomCBlankStep);
SW_INT16 IPZ_ZBC_LENS_GetLensOrigion(void);
void IPZ_ZBC_LENS_SetLensOrigion(SW_INT16 s16LensOrigion);
SW_BOOL IPZ_ZBC_LENS_GetZoomDirectRunningFlag(void);
void IPZ_ZBC_LENS_SetZoomDirectRunningFlag(SW_BOOL bIsZoomDirectRunning);
SW_BOOL IPZ_ZBC_LENS_GetFocusDirectRunningFlag (void);
void IPZ_ZBC_LENS_SetFocusDirectRunningFlag(SW_BOOL bIsFocusDirectRunning);
SW_UINT32 IPZ_ZBC_LENS_GetLensParamNum(void);
SW_INT IPZ_ZBC_LENS_GetLastZoomDiff(void);
void IPZ_ZBC_LENS_SetLastZoomDiff(SW_INT s32LastAdjustZoomDiff);
SW_INT IPZ_ZBC_LENS_GetLastAdjustTemp(void);
void IPZ_ZBC_LENS_SetLastAdjustTemp(SW_INT s32LastAdjustTmp);
void IPZ_ZBC_LENS_TempShift(void);

#endif

